package com.gecba.system.config.web;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * @author ChenBo
 * @className CrosConfig
 * @date 2021/7/22
 */
@Configuration
public class CorsConfig extends WebMvcConfigurationSupport {


    /**
     *跨域访问
     *@author ChenBo
     *@date 2021/7/22
     */
    @Override
    protected void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowCredentials(true)
                .allowedHeaders("*")
                .allowedOrigins("http://localhost:3000")
                .allowedMethods("*");
    }
}
